/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Core.impl;

import EA_Model.IEC61970.Core.CorePackage;
import EA_Model.IEC61970.Core.VoltageLevel;

import EA_Model.IEC61970.Domain.Voltage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Voltage Level</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Core.impl.VoltageLevelImpl#getHighVoltageLimit <em>High Voltage Limit</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Core.impl.VoltageLevelImpl#getLowVoltageLimit <em>Low Voltage Limit</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class VoltageLevelImpl extends EquipmentContainerImpl implements VoltageLevel {
	/**
	 * The cached value of the '{@link #getHighVoltageLimit() <em>High Voltage Limit</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHighVoltageLimit()
	 * @generated
	 * @ordered
	 */
	protected Voltage highVoltageLimit;

	/**
	 * The cached value of the '{@link #getLowVoltageLimit() <em>Low Voltage Limit</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLowVoltageLimit()
	 * @generated
	 * @ordered
	 */
	protected Voltage lowVoltageLimit;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected VoltageLevelImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CorePackage.Literals.VOLTAGE_LEVEL;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage getHighVoltageLimit() {
		if (highVoltageLimit != null && highVoltageLimit.eIsProxy()) {
			InternalEObject oldHighVoltageLimit = (InternalEObject)highVoltageLimit;
			highVoltageLimit = (Voltage)eResolveProxy(oldHighVoltageLimit);
			if (highVoltageLimit != oldHighVoltageLimit) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.VOLTAGE_LEVEL__HIGH_VOLTAGE_LIMIT, oldHighVoltageLimit, highVoltageLimit));
			}
		}
		return highVoltageLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage basicGetHighVoltageLimit() {
		return highVoltageLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setHighVoltageLimit(Voltage newHighVoltageLimit) {
		Voltage oldHighVoltageLimit = highVoltageLimit;
		highVoltageLimit = newHighVoltageLimit;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.VOLTAGE_LEVEL__HIGH_VOLTAGE_LIMIT, oldHighVoltageLimit, highVoltageLimit));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage getLowVoltageLimit() {
		if (lowVoltageLimit != null && lowVoltageLimit.eIsProxy()) {
			InternalEObject oldLowVoltageLimit = (InternalEObject)lowVoltageLimit;
			lowVoltageLimit = (Voltage)eResolveProxy(oldLowVoltageLimit);
			if (lowVoltageLimit != oldLowVoltageLimit) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.VOLTAGE_LEVEL__LOW_VOLTAGE_LIMIT, oldLowVoltageLimit, lowVoltageLimit));
			}
		}
		return lowVoltageLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage basicGetLowVoltageLimit() {
		return lowVoltageLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLowVoltageLimit(Voltage newLowVoltageLimit) {
		Voltage oldLowVoltageLimit = lowVoltageLimit;
		lowVoltageLimit = newLowVoltageLimit;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.VOLTAGE_LEVEL__LOW_VOLTAGE_LIMIT, oldLowVoltageLimit, lowVoltageLimit));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CorePackage.VOLTAGE_LEVEL__HIGH_VOLTAGE_LIMIT:
				if (resolve) return getHighVoltageLimit();
				return basicGetHighVoltageLimit();
			case CorePackage.VOLTAGE_LEVEL__LOW_VOLTAGE_LIMIT:
				if (resolve) return getLowVoltageLimit();
				return basicGetLowVoltageLimit();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CorePackage.VOLTAGE_LEVEL__HIGH_VOLTAGE_LIMIT:
				setHighVoltageLimit((Voltage)newValue);
				return;
			case CorePackage.VOLTAGE_LEVEL__LOW_VOLTAGE_LIMIT:
				setLowVoltageLimit((Voltage)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CorePackage.VOLTAGE_LEVEL__HIGH_VOLTAGE_LIMIT:
				setHighVoltageLimit((Voltage)null);
				return;
			case CorePackage.VOLTAGE_LEVEL__LOW_VOLTAGE_LIMIT:
				setLowVoltageLimit((Voltage)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CorePackage.VOLTAGE_LEVEL__HIGH_VOLTAGE_LIMIT:
				return highVoltageLimit != null;
			case CorePackage.VOLTAGE_LEVEL__LOW_VOLTAGE_LIMIT:
				return lowVoltageLimit != null;
		}
		return super.eIsSet(featureID);
	}

} //VoltageLevelImpl
